let isDone:boolean = false;

let num:number = 6;

let names:string = 'saeg';
    names = '123456';

let nameN : string = `Gene`;
let age :number = 35;
let sentence: string = `13246546584${nameN}aefaefafe${age}`;

let list : number[]=[12,12,32,22];
let list1:Array<String> = ['132','srg','arg'];

//元组，定义好类型
let x :[string,number,string];
    x=['hello',10,'1531'];
    x[3] = 'world'; // OK, 字符串可以赋值给(string | number)类型
    x[4] = 123; // OK, 数字可以赋值给(string | number)类型
// console.log(x[0].substr(1)); // 访问元组
// console.log(x[3].toString()); // 访问元组
// console.log(x[4].toString()); // OK, 'string' 和 'number' 都有 toString

// 这是枚举
enum colors {Red,Green,Blue};//默认从0开始
let col : colors = colors.Green;

enum color1 {Red = 1, Green = 2, Blue = 4};//手动赋值

enum color2 {Red = 1, Green, Blue};
let colorName: string = color2[2];

// 任意值
let anyList: any[] = [1, true, "free"];
anyList[1] = 100;

//没有返回类型
function warnUser(): void {
    // alert("This is my warning message");
}

// void类型的变量，只能为它赋予undefined和null
let unusable:void = undefined;

//undefined和null两者的类型
let u: undefined = undefined;
let n: null = null;

// 返回never的函数必须存在无法达到的终点
function error(message: string): never {
    throw new Error(message);
}

// 推断的返回值类型为never
function fail() {
    return error("Something failed");
}

// 返回never的函数必须存在无法达到的终点
function infiniteLoop(): never {
    while (true) {
    }
}

//类型断言 转换类型
let someValue: any = '123456';
let strLength: number = (<string>someValue).length;
